import Vue from "vue";

export function getProducts (params) {
    return Vue.axios.get('/products', {params})
}

export function getProduct (id) {
    return Vue.axios.get(`/products/${id}`)
}

export function getCarts (params) {
    return Vue.axios.get('/carts', params)
}

export function getCartCount () {
    return Vue.axios.get('/carts/products/sum')
}

export function addCart (params) {
    return Vue.axios.post('/carts', params)
}

export function deleteCart (productId) {
    return Vue.axios.delete(`/carts/${productId}`)
}

export function updateCart (productId, data) {
    return Vue.axios.put(`/carts/${productId}`, data)
}

export function selectAllCarts () {
    return Vue.axios.put('/carts/selectAll')
}

export function unSelectAllCarts () {
    return Vue.axios.put('/carts/unSelectAll')
}

export function getAddress () {
    return Vue.axios.get('/shippings')
}
